{extend name='public/base' /}
{block name='content'}
{include file='public/content_header' /}
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <!-- 表单头部 -->
                <div class="box-header with-border">
                    <div class="btn-group">
                        <a class="btn flat btn-sm btn-default BackButton">
                            <i class="fa fa-arrow-left"></i>
                            返回
                        </a>
                    </div>
                </div>
                <!-- 表单 -->
                <form id="dataForm" class="form-horizontal dataForm" action="" method="post"
                      enctype="multipart/form-data">
                    <!-- 表单字段区域 -->
                    <div class="box-body">

                        <div class="form-group">
                            <label for="ota_group" class="col-sm-2 control-label">选择分组</label>
                            <div class="col-sm-10 col-md-4">
                                <select name="ota_group" id="ota_group" class="form-control input-sm index-order">
                                    <option value="">请选择</option>
                                    {foreach $UserData as $u}
                                        <option value="{$u.id}" {if isset($data.ota_group) && $data.ota_group==$u.id}selected{/if}>{$u.group_name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <script>
                            $('#ota_group').select2();
                        </script>

                        <div class="form-group">
                            <label for="ota_name" class="col-sm-2 control-label">设备号</label>
                            <div class="col-sm-10 col-md-4">
                                <input id="ota_name" name="ota_name" value="{$data.ota_name|default=''}"
                                       placeholder="请输入设备号" type="text" class="form-control field-text">
                            </div>
                        </div>
                    </div>
                    <!-- 表单底部 -->
                    <div class="box-footer">
                        {:token()}
                        <div class="col-sm-2">
                        </div>
                        <div class="col-sm-10 col-md-4">
                            {if !isset($data)}
                            <div class="btn-group pull-right">
                                <label class="createContinue">
                                    <input type="checkbox" value="1" id="_create" name="_create"
                                           title="继续添加数据">继续添加</label>
                            </div>
                            {/if}
                            <div class="btn-group">
                                <button type="submit" class="btn flat btn-info dataFormSubmit">
                                    保存
                                </button>
                            </div>
                            <div class="btn-group">
                                <button type="reset" class="btn flat btn-default dataFormReset">
                                    重置
                                </button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>
<script>
    /** 表单验证 **/
    $('#dataForm').validate({
        rules: {
            'ota_name': {
                required: true,
            },

        },
        messages: {
            'ota_name': {
                required: "设备号不能为空",
            },

        }
    });
</script>
{/block}